package com.situ.ssm.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.situ.ssm.entity.PageInfo;
import com.situ.ssm.service.IBanjiService;
import com.situ.ssm.service.impl.BanjiServiceImpl;

@Controller
@RequestMapping(value = "/banji")
public class BanjiController {
	private IBanjiService banjiService = new BanjiServiceImpl();
	
	@RequestMapping(value = "/findByPage")
	public String findByPage(@RequestParam(defaultValue = "1")Integer pageNo, 
			@RequestParam(defaultValue = "5")Integer pageSize, Model model) {
		System.out.println("BanjiController.findByPage()");
		System.out.println("pageNo: " + pageNo);
		System.out.println("pageSize: " + pageSize);
		PageInfo pageInfo = banjiService.findByPage(pageNo, pageSize);
		System.out.println(pageInfo);
		model.addAttribute("pageInfo", pageInfo);
		return "/banji_list.jsp";
	}
}
